package com.ttdevs.ticktackalert.appwidgets;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Vibrator;

import com.ttdevs.ticktackalert.R;

public class Alert extends Activity {
	private final static String ALARMMESSAGE = "alarmmessage";
	private Vibrator vibrator;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		Intent intent = getIntent();
		String alarmMessage = intent.getStringExtra(ALARMMESSAGE);
		vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
		vibrator.vibrate(new long[] { 1000, 10, 100, 1000 }, 0);
		AlertDialog alertDialog = new AlertDialog.Builder(this)
				.setCancelable(false)
				.setTitle(R.string.alarm_title)
				.setMessage(alarmMessage)
				.setPositiveButton(R.string.app_submit,
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int whichButton) {
								vibrator.cancel();
								finish();
							}
						}).create();
		alertDialog.show();
	}
}
